package com.sample.classes.testing;

import com.actionbarsherlock.app.ActionBar;
import com.actionbarsherlock.app.ActionBar.Tab;
import com.actionbarsherlock.view.MenuItem;
import com.apps.realtyportal.HomeActivity;
import com.apps.realtyportal.LocationFragment;
import com.apps.realtyportal.R;
import com.apps.realtyportal.R.layout;

import android.app.TabActivity;
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.support.v4.app.FragmentTransaction;
import android.widget.FrameLayout;
import android.widget.TabHost;
import android.widget.TabHost.TabSpec;

@SuppressWarnings({ "unused", "deprecation" })
public class AppMainSearch extends TabActivity {
	TabHost mTabHost;
	FrameLayout mFrameLayout;
	ActionBar actionBar;
	/** Called when the activity is first created. */
	@SuppressWarnings("deprecation")
	@Override
	public void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.mapsearch);
		//actionBar = getASupportActionBar();
		mTabHost = getTabHost();
		TabSpec tabSpec = mTabHost.newTabSpec("tab_test1");
		tabSpec.setIndicator("Location");
		Context ctx = this.getApplicationContext();
		Intent i = new Intent(ctx, LocationFragment.class);
		tabSpec.setContent(i);
		mTabHost.addTab(tabSpec);
		mTabHost.addTab(mTabHost.newTabSpec("tab_test2")
				.setIndicator("Price").setContent(i));
		mTabHost.setCurrentTab(0);
		mTabHost.addTab(mTabHost.newTabSpec("tab_test3")
				.setIndicator("Type").setContent(i));
		//mTabHost.setCurrentTab(1);
	}
	
	public boolean onOptionsItemSelected(android.view.MenuItem item) {
		switch (item.getItemId()) {
		case android.R.id.home:
			Intent intent = new Intent(this, HomeActivity.class);
			intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TASK);
			startActivity(intent);
		}
		return super.onOptionsItemSelected(item);
	}
	
    public void onTabReselected(Tab tab, FragmentTransaction transaction) {
    }

    
    public void onTabSelected(Tab tab, FragmentTransaction transaction) {
        //mSelected.setText("Selected: " + tab.getText());
    }

    
    public void onTabUnselected(Tab tab, FragmentTransaction transaction) {
    }
}
